/*
 * @Creator: 小傲
 * @Date: 2023-04-07 19:46:01
 */
define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'supply.quoted/index',
        import_url: 'supply.quoted/import',
        modify_url: 'supply.quoted/modify',
        receive_url: 'supply.quoted/receive',
    };

    
    var Controller = {

        index: function () {

            ea.table.render({
                init: init,
				toolbar:['refresh',
                [{
                    text: '批量导入',
                    url: init.import_url,
                    method: 'open',
                    auth: 'add',
                    class: 'layui-btn layui-btn-normal layui-btn-sm',
                }],
            ],
                cols: [[
                    { type: "checkbox", width: 50 },
                    { field: 'id', width: 60, title: 'ID', sort: true, search:false},
                    { field: 'product.names', title: '产品名' ,width: 100},   
                    { field: 'specs', title: '规格' ,width: 100},   
                    { field: 'price', title: '价格' ,width: 100},   
					{ field: 'company_id', title: '厂家id' ,width: 100},   
					{ field: 'admin.username', title: '创建者' ,width: 120},  
                    { field: 'status', width: 85,title: '状态', search:'select' , selectList: {0: '禁用', 1: '启用'}, templet: ea.table.switch},  
                    { field: 'create_time',  title: '创建时间',search:false},
					{ field: 'update_time',  title: '修改时间',search:false},
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
        import: function () {
            ea.listen();
        }
    };
    return Controller;
});